﻿#if NETCore
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Primitives;
#endif
using System;

namespace Longbow.Cache
{
    public static class TestHelper
    {
#if NETCore
        /// <summary>
        /// 
        /// </summary>
        public static void TriggerAppSettingsFileChange(IConfiguration configuration, Action changeCallback)
        {
            ChangeToken.OnChange(() => configuration.GetReloadToken(), () => changeCallback.Invoke());
            var root = (ConfigurationRoot)configuration;
            root.Reload();
        }
#endif
    }
}
